<template>
  <view class="gift_card_success">
    <image class="success_icon" :src="oss2('funCard/success_icon.png')"></image>
    <view class="success_status">提交成功！</view>
    <view class="success_text">礼物即将发出</view>
    <view class="list_btn" @click.stop="toOrder">查看订单</view>
    <view class="back_btn" @click.stop="toHome">返回首页</view>
  </view>


</template>

    <script setup>
import { oss2 } from "@/utils/utils";
import { onShow, onUnload, onHide } from "@dcloudio/uni-app";
import privacyPopup from "@/components/privacy-popup";

let enterTime = "";
let outTime = "";
let stayTime = "";

onShow(() => {
  // 用户进入时间
  enterTime = new Date();
  getApp().accessLogAdd();
});
onHide(() => {
  // 用户退出时间
  outTime = new Date();
  //停留时间(毫秒)
  stayTime = (outTime?.getTime() - enterTime?.getTime()) / 1000;
  getApp().emdlz2(
    "track",
    "event",
    "fc_submit_address",
    "view",
    "fc_successful_submission_page",
    stayTime
  );
});
onUnload(() => {
  // 用户退出时间
  outTime = new Date();
  //停留时间(毫秒)
  stayTime = (outTime?.getTime() - enterTime?.getTime()) / 1000;
  getApp().emdlz2(
    "track",
    "event",
    "fc_submit_address",
    "view",
    "fc_successful_submission_page",
    stayTime
  );
});

const toOrder = () => {
  getApp().emdlz2(
    "track",
    "event",
    "fc_submit_address",
    "click",
    "fc_view_orders",
    ""
  );
  uni.redirectTo({
    url: "/funCard/order?orderType=1",
  });
};
const toHome = () => {
  getApp().emdlz2(
    "track",
    "event",
    "fc_submit_address",
    "click",
    "fc_back_homepage",
    ""
  );
  uni.redirectTo({
    url: "/funCard/index",
  });
};
</script>

    <style lang="less" scoped>
.gift_card_success {
  position: relative;
  width: 375px;
  height: 100vh;
  background-color: #fff;
  box-sizing: border-box;
  padding-top: 143px;
  color: #000000;
  font-size: 15px;
  font-weight: 400;
  text-align: center;

  .success_icon {
    width: 68px;
    height: 68px;
    margin-bottom: 23px;
  }
  .success_status {
    padding-left: 10px;
    letter-spacing: 1px;
    height: 24px;
    line-height: 24px;
    margin-bottom: 17px;
    font-size: 24px;
    font-weight: bold;
    color: #000000;
  }
  .success_text {
    font-size: 12px;
    color: #747474;
  }
  .list_btn,
  .back_btn {
    width: 246px;
    height: 42px;
    line-height: 42px;
    background: #0044c9;
    box-shadow: 0px 4px 9px 0px rgba(0, 79, 234, 0.4);
    border-radius: 21px;
    color: #fff;
    position: absolute;
    left: 65px;
  }
  .list_btn {
    bottom: 169px;
  }
  .back_btn {
    bottom: 103px;
  }
}
</style>
